<template>
  <van-nav-bar
      title="收货地址"
      left-text="返回"
      left-arrow
      @click-left="onClickLeft"
  />
  <van-address-edit
      :area-list="areaList"
      show-postal
      show-delete
      show-set-default
      show-search-result
      :search-result="searchResult"
      :area-columns-placeholder="['请选择', '请选择', '请选择']"
      @save="onSave"
      @delete="onDelete"
      @change-detail="onChangeDetail"
  />
</template>

<script>
import { ref } from 'vue';
import { Toast } from 'vant';
export default {
  name: "newAddress",
  data(){
    return{
      areaList: ''
    }
  },
  setup() {

      const onClickLeft = () => history.back();
      return {
        onClickLeft,
    }
    const searchResult = ref([]);

    const onSave = () => Toast('save');
    const onDelete = () => Toast('delete');
    const onChangeDetail = (val) => {
      if (val) {
        searchResult.value = [
          {
            name: '东软睿道',
            address: '天津市东丽区',
          },
        ];
      } else {
        searchResult.value = [];
      }
    };

    return {
      onSave,
      onDelete,
      searchResult,
      onChangeDetail,
    };
  },
}
</script>

<style scoped lang="stylus">

</style>